package com.System.service.LoginImpl;

import com.System.Dao.LoginDao;
import com.System.pojo.User;
import com.System.service.Login;
import com.System.untils.SqlSessionFactoryUtils;
import com.cloudHouse.session.SqlSession;
import com.cloudHouse.session.SqlSessionFactory;

public class LoginService implements Login {
    SqlSessionFactory sqlSessionFactory= SqlSessionFactoryUtils.getSqlSessionFactory();
    @Override
    public User login(User user) {
        SqlSession sqlSession = sqlSessionFactory.openSession();
        LoginDao mapper = sqlSession.getMapper(LoginDao.class);
        return mapper.login(user);


    }

    @Override
    public User selectPasswordByUserName(User user) {
        SqlSession sqlSession = sqlSessionFactory.openSession();
        LoginDao mapper = sqlSession.getMapper(LoginDao.class);
        User result = mapper.selectPasswordByUserName(user);
        sqlSession.close();
        return result;
    }
}
